The Hebrew slavery in Egypt.
Joseph was sold into slavery by his own relatives. He was a man of great integrity and refused to get involved with fornication. He suffered unjustly and even lost his status as a slave and was put in prison where he had to wear iron fetters.
He was utterly helpless and betrayed. But a way out was made for him, because the hand of Almighty God was with him.Therefore, Joseph came to be over the house of pharaoh and all the people had to obey him.
Later he even made-up, not with those for whom he had slaved but those who had put him into slavery. Ie HIS OWN BROTHERS.
Also he recognised the benefits that had come from the hardship he had suffered.
(Genesis 45:4-8) . . .Then he said: “I am Joseph your brother, whom YOU SOLD INTO EGYPT. 5 But now do not feel hurt and do not be angry with yourselves because YOU SOLD ME HERE; because for the preservation of life God has sent me ahead of you. 6 For this is the second year of the famine in the midst of the earth, and there are yet five years in which there will be no plowing time or harvest. 7 Consequently God sent me ahead of you in order to place a remnant for you men in the earth and to keep you alive by a great escape. 8 So now it was not you who sent me here, but it was the [true] God, that he might appoint me a father to Pharaoh and a lord for all his house and as one dominating over all the land of Egypt.